﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AKMII.DMRA.Common
{
    public class Assignment
    {
        public int AgentId { get; set; }

        public string AgentName { get; set; }

        public int ActiveLeadCount { get; set; }

        public int LapsedLeadCount { get; set; }

        public int BusinessLeadCount { get; set; }

        public int NeighborLeadCount { get; set; }

        public double ClassRate { get; set; }

        public double ClassRate2 { get; set; }

        #region Agent Ratios

        public double ActiveContacts { get; set; }

        public double ActiveAppointMade { get; set; }

        public double ActiveAppointKept { get; set; }

        public double ActivePresentation { get; set; }

        public double ActiveAppointSale { get; set; }

        public double LapsedContacts { get; set; }

        public double LapsedAppointMade { get; set; }

        public double LapsedAppointKept { get; set; }

        public double LapsedPresentation { get; set; }

        public double LapsedAppointSale { get; set; }

        public double NeighborContacts { get; set; }

        public double NeighborAppointMade { get; set; }

        public double NeighborAppointKept { get; set; }

        public double NeighborPresentation { get; set; }

        public double NeighborAppointSale { get; set; }

        public double BusinessContacts { get; set; }

        public double BusinessAppointMade { get; set; }

        public double BusinessAppointKept { get; set; }

        public double BusinessPresentation { get; set; }

        public double BusinessAppointSale { get; set; }

        public double RefContacts { get; set; }

        public double RefAppointMade { get; set; }

        public double RefAppointKept { get; set; }

        public double RefPresentation { get; set; }

        public double RefAppointSale { get; set; }

        public double TSystemContacts { get; set; }

        public double TSystemAppointMade { get; set; }

        public double TSystemAppointKept { get; set; }

        public double TSystemPresentation { get; set; }

        public double TSystemAppointSale { get; set; }

        public double TargetMarketContacts { get; set; }

        public double TargetMarketAppointMade { get; set; }

        public double TargetMarketAppointKept { get; set; }

        public double TargetMarketPresentation { get; set; }

        public double TargetMarketAppointSale { get; set; }

        public double FieldContacts { get; set; }

        public double FieldAppointMade { get; set; }

        public double FieldAppointKept { get; set; }

        public double FieldPresentation { get; set; }

        public double FieldAppointSale { get; set; }

        public double AvgAPVperApp { get; set; }
        
        #endregion

        #region Agent Potential

        public int AOpportunity { get { return ActiveLeadCount; } }

        public int AContacts { get { return Convert.ToInt32(AOpportunity * ActiveContacts); } }

        public int AAppointMade { get { return Convert.ToInt32(AContacts * ActiveAppointMade); } }

        public int AAppointKept { get { return Convert.ToInt32(AAppointMade * ActiveAppointKept); } }

        public int APresentation { get { return Convert.ToInt32(ActivePresentation * (AContacts - AAppointMade) + AAppointKept * 0.9); } }

        public int AAppointSale { get { return Convert.ToInt32(APresentation * ActiveAppointSale); } }

        public int LOpportunity { get { return LapsedLeadCount; } }

        public int LContacts { get { return Convert.ToInt32(LOpportunity * LapsedContacts); } }

        public int LAppointMade { get { return Convert.ToInt32(LContacts * LapsedAppointMade); } }

        public int LAppointKept { get { return Convert.ToInt32(LAppointMade * LapsedAppointKept); } }

        public int LPresentation { get { return Convert.ToInt32(LapsedPresentation * (LContacts - LAppointMade) + LAppointKept * 0.7); } }

        public int LAppointSale { get { return Convert.ToInt32(LPresentation * LapsedAppointSale); } }

        public int BOpportunity { get { return BusinessLeadCount; } }

        public int BContacts { get { return Convert.ToInt32(BOpportunity * BusinessContacts); } }

        public int BAppointMade { get { return Convert.ToInt32(BContacts * 0.66 * BusinessAppointMade); } }

        public int BAppointKept { get { return Convert.ToInt32(BAppointMade  * BusinessAppointKept); } }

        public int BPresentation { get { return Convert.ToInt32(BusinessPresentation * (BContacts - BAppointMade) + BAppointKept * 0.7); } }

        public int BAppointSale { get { return Convert.ToInt32(BPresentation * BusinessAppointSale); } }

        public int NOpportunity { get { return NeighborLeadCount; } }

        public int NContacts { get { return Convert.ToInt32(NOpportunity * NeighborContacts); } }

        public int NAppointMade { get { return Convert.ToInt32(NContacts * 0.66 * NeighborAppointMade); } }

        public int NAppointKept { get { return Convert.ToInt32(NAppointMade * NeighborAppointKept); } }

        public int NPresentation { get { return Convert.ToInt32(NeighborPresentation * (NContacts - NAppointMade) + NAppointKept * 0.7); } }

        public int NAppointSale { get { return Convert.ToInt32(NPresentation * NeighborAppointSale); } }

        public int CCPOpportunity { get { return AOpportunity + BOpportunity + LOpportunity + NOpportunity; } }

        public int CCPContacts { get { return AContacts + BContacts + LContacts + NContacts; } }

        public int CCPAppointMade { get { return AAppointMade + BAppointMade + LAppointMade + NAppointMade; } }

        public int CCPAppointKept { get { return AAppointKept + BAppointKept + LAppointKept + NAppointKept; } }

        public int CCPPresentation { get { return APresentation + BPresentation + LPresentation + NPresentation; } }

        public int CCPAppointSale { get { return AAppointSale + BAppointSale + LAppointSale + NAppointSale; } }

        public int ROpportunity { get { return BPresentation + APresentation + LPresentation + NPresentation; } }

        public int RContacts { get { return Convert.ToInt32(ROpportunity * RefContacts); } }

        public int RAppointMade { get { return Convert.ToInt32(RContacts * 0.66 * RefAppointMade); } }

        public int RAppointKept { get { return Convert.ToInt32(RAppointMade * RefAppointKept); } }

        public int RPresentation { get { return Convert.ToInt32(RefPresentation * (RContacts - RAppointMade) + RAppointKept * 0.7); } }

        public int RAppointSale { get { return Convert.ToInt32(RPresentation * RefAppointSale); } }

        public int TSOpportunity { get { return BOpportunity * 2; } }

        public int TSContacts { get { return Convert.ToInt32(TSOpportunity * TSystemContacts); } }

        public int TSAppointMade { get { return Convert.ToInt32(TSContacts * 0.66 * TSystemAppointMade); } }

        public int TSAppointKept { get { return Convert.ToInt32(TSAppointMade * TSystemAppointKept); } }

        public int TSPresentation { get { return Convert.ToInt32(TSystemPresentation * (TSContacts - TSAppointMade) + TSAppointKept * 0.7); } }

        public int TSAppointSale { get { return Convert.ToInt32(TSPresentation * TSystemAppointSale); } }

        public int TMOpportunity { get { return (AOpportunity / 2); } }

        public int TMContacts { get { return Convert.ToInt32(TMOpportunity * TargetMarketContacts); } }

        public int TMAppointMade { get { return Convert.ToInt32(TMContacts * 0.5 * TargetMarketAppointMade); } }

        public int TMAppointKept { get { return Convert.ToInt32(TMAppointMade * TargetMarketAppointKept); } }

        public int TMPresentation { get { return Convert.ToInt32(TargetMarketPresentation * (TMContacts - TMAppointMade) + TMAppointKept * 0.7); } }

        public int TMAppointSale { get { return Convert.ToInt32(TMPresentation * TargetMarketAppointSale); } }

        public int FROpportunity { get { return (AOpportunity / 10); } }

        public int FRContacts { get { return Convert.ToInt32(FROpportunity * FieldContacts); } }

        public int FRAppointMade { get { return Convert.ToInt32(FRContacts * FieldAppointMade); } }

        public int FRAppointKept { get { return Convert.ToInt32(FRAppointMade * FieldAppointKept); } }

        public int FRPresentation { get { return Convert.ToInt32(FieldPresentation * (FRContacts - FRAppointMade) + FRAppointKept * 0.9); } }

        public int FRAppointSale { get { return Convert.ToInt32(FRPresentation * FieldAppointSale); } }

        public int APOpportunity { get { return ROpportunity + TSOpportunity + TMOpportunity + FROpportunity + CCPOpportunity; } }

        public int APContacts { get { return RContacts + TSContacts + TMContacts + FRContacts + CCPContacts; } }

        public int APAppointMade { get { return RAppointMade + TSAppointMade + TMAppointMade + FRAppointMade + CCPAppointMade; } }

        public int APAppointKept { get { return RAppointKept + TSAppointKept + TMAppointKept + FRAppointKept + CCPAppointKept; } }

        public int APPresentation { get { return RPresentation + TSPresentation + TMPresentation + FRPresentation + CCPPresentation; } }

        public int APAppointSale { get { return RAppointSale + TSAppointSale + TMAppointSale + FRAppointSale + CCPAppointSale; } }

        public int AAvgAPV { get { return Convert.ToInt32(AvgAPVperApp); } }

        public int AEstimatedAPV { get { return AAppointSale * AAvgAPV; } }

        public int AAnnualizedIncome { get { return Convert.ToInt32(ClassRate2 * AEstimatedAPV); } }

        public int AAdvancedIncome { get { return Convert.ToInt32(ClassRate2 * AEstimatedAPV * 0.5); } }

        public int LAvgAPV { get { return AAvgAPV; } }

        public int LEstimatedAPV { get { return LAppointSale * LAvgAPV; } }

        public int LAnnualizedIncome { get { return Convert.ToInt32(ClassRate * LEstimatedAPV); } }

        public int LAdvancedIncome { get { return Convert.ToInt32(ClassRate * LEstimatedAPV * 0.5); } }

        public int BAvgAPV { get { return Convert.ToInt32(AAvgAPV * 1.2); } }

        public int BEstimatedAPV { get { return BAppointSale * BAvgAPV; } }

        public int BAnnualizedIncome { get { return Convert.ToInt32(ClassRate * BEstimatedAPV); } }

        public int BAdvancedIncome { get { return Convert.ToInt32(ClassRate * BEstimatedAPV * 0.5); } }

        public int NAvgAPV { get { return AAvgAPV; } }

        public int NEstimatedAPV { get { return BAppointSale * NAvgAPV; } }

        public int NAnnualizedIncome { get { return Convert.ToInt32(ClassRate * NEstimatedAPV); } }

        public int NAdvancedIncome { get { return Convert.ToInt32(ClassRate * NEstimatedAPV * 0.5); } }

        public int CCPAvgAPV { get { return Convert.ToInt32(CCPEstimatedAPV /CCPAppointSale); } }

        public int CCPEstimatedAPV { get { return AEstimatedAPV + BEstimatedAPV + LEstimatedAPV + NEstimatedAPV; } }

        public int CCPAnnualizedIncome { get { return AAnnualizedIncome + BAnnualizedIncome + LAnnualizedIncome + NAnnualizedIncome; } }

        public int CCPAdvancedIncome { get { return AAdvancedIncome + BAdvancedIncome + LAdvancedIncome + NAdvancedIncome; } }

        public int RAvgAPV { get { return Convert.ToInt32(AAvgAPV * 1.1); } }

        public int REstimatedAPV { get { return RAppointSale * RAvgAPV; } }

        public int RAnnualizedIncome { get { return Convert.ToInt32(ClassRate * REstimatedAPV); } }

        public int RAdvancedIncome { get { return Convert.ToInt32(ClassRate * REstimatedAPV * 0.5); } }

        public int TSAvgAPV { get { return Convert.ToInt32(AAvgAPV * 1.1); } }

        public int TSEstimatedAPV { get { return TSAppointSale * TSAvgAPV; } }

        public int TSAnnualizedIncome { get { return Convert.ToInt32(ClassRate * TSEstimatedAPV); } }

        public int TSAdvancedIncome { get { return Convert.ToInt32(ClassRate * TSEstimatedAPV * 0.5); } }

        public int TMAvgAPV { get { return Convert.ToInt32(AAvgAPV * 1.1); } }

        public int TMEstimatedAPV { get { return TMAppointSale * TMAvgAPV; } }

        public int TMAnnualizedIncome { get { return Convert.ToInt32(ClassRate * TMEstimatedAPV); } }

        public int TMAdvancedIncome { get { return Convert.ToInt32(ClassRate * TMEstimatedAPV * 0.5); } }

        public int FRAvgAPV { get { return Convert.ToInt32(AAvgAPV * 1.1); } }

        public int FREstimatedAPV { get { return FRAppointSale * FRAvgAPV; } }

        public int FRAnnualizedIncome { get { return Convert.ToInt32(ClassRate2 * FREstimatedAPV); } }

        public int FRAdvancedIncome { get { return Convert.ToInt32(ClassRate2 * FREstimatedAPV * 0.5); } }

        public int APAvgAPV { get { return Convert.ToInt32(APEstimatedAPV / APAppointSale); } }

        public int APEstimatedAPV { get { return REstimatedAPV + TSEstimatedAPV + TMEstimatedAPV + FREstimatedAPV + CCPEstimatedAPV; } }

        public int APAnnualizedIncome { get { return RAnnualizedIncome + TSAnnualizedIncome + TMAnnualizedIncome + FRAnnualizedIncome + CCPAnnualizedIncome; } }

        public int APAdvancedIncome { get { return RAdvancedIncome + TSAdvancedIncome + TMAdvancedIncome + FRAdvancedIncome + CCPAdvancedIncome; } }
        
        #endregion
    }
}
